macro(cctools_misc_executable name)
    add_executable(host_${name} ${name}.c)
    set_property(TARGET host_${name} PROPERTY OUTPUT_NAME ${name})
    target_link_libraries(host_${name} PRIVATE host_libmacho host_libstuff)
    target_include_directories(host_${name} PRIVATE ../include ../include/foreign ../libstuff)
    target_compile_definitions(host_${name} PRIVATE -D__DARWIN_UNIX03)
endmacro()

cctools_misc_executable(checksyms)
cctools_misc_executable(lipo)
cctools_misc_executable(size)
cctools_misc_executable(strings)
cctools_misc_executable(nm)
cctools_misc_executable(libtool)
cctools_misc_executable(redo_prebinding)
cctools_misc_executable(seg_addr_table)
cctools_misc_executable(seg_hack)
cctools_misc_executable(install_name_tool)
cctools_misc_executable(indr)
cctools_misc_executable(strip)
cctools_misc_executable(segedit)
cctools_misc_executable(pagestuff)
cctools_misc_executable(codesign_allocate)
cctools_misc_executable(bitcode_strip)
target_compile_definitions(host_bitcode_strip PRIVATE -DALLOW_ARCHIVES)
cctools_misc_executable(ctf_insert)
cctools_misc_executable(check_dylib)
cctools_misc_executable(cmpdylib)
cctools_misc_executable(inout)
cctools_misc_executable(vtool)

suppress_all_warnings(host_bitcode_strip)
suppress_all_warnings(host_install_name_tool)
suppress_all_warnings(host_strip)
suppress_all_warnings(host_vtool)

# Special cases
add_executable(host_nmedit strip.c)
target_link_libraries(host_nmedit PRIVATE host_libmacho host_libstuff)
target_include_directories(host_nmedit PRIVATE ../include ../include/foreign ../libstuff)
target_compile_definitions(host_nmedit PRIVATE -D__DARWIN_UNIX03 -DNMEDIT)

add_executable(host_ranlib libtool.c)
target_link_libraries(host_ranlib PRIVATE host_libmacho host_libstuff)
target_include_directories(host_ranlib PRIVATE ../include ../include/foreign ../libstuff)
target_compile_definitions(host_ranlib PRIVATE -D__DARWIN_UNIX03 -DRANLIB)
